﻿using BCEntity.Sim.Admin.TreePermission;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BCData.Sim.Admin.TreePermission
{
    /// <summary>
    /// 新版无限级树形权限
    /// </summary>
    public interface ITreePermissionConfigData
    {
        /// <summary>
        /// 检查权限码是否存在
        /// </summary>
        /// <param name="permissionCode">权限码</param>
        /// <returns></returns>
        Task<bool> CheckExists(string permissionCode);

        /// <summary>
        /// 添加树形权限
        /// </summary>
        /// <param name="entity">树形权限</param>
        /// <returns></returns>
        Task<TreePermissionConfigEntity> InsertAsync(TreePermissionConfigEntity entity);

        /// <summary>
        /// 获取树形权限
        /// </summary>
        /// <param name="treePermissionConfigId">树形权限配置Id</param>
        /// <returns></returns>
        Task<TreePermissionConfigEntity> GetEntityAsync(long treePermissionConfigId);
        /// <summary>
        /// 获取树形权限
        /// </summary>
        /// <param name="parentPermissionPathCode">父级树形权限Code</param>
        /// <returns></returns>
        Task<TreePermissionConfigEntity> GetEntityAsync(string parentPermissionPathCode);
        /// <summary>
        /// 更新树形权限
        /// </summary>
        /// <param name="entity">树形权限</param>
        /// <returns></returns>
        Task<TreePermissionConfigEntity> Update(TreePermissionConfigEntity entity);

        /// <summary>
        /// 更新树形权限是否显示
        /// </summary>
        /// <param name="treePermissionConfigId">树形权限配置Id</param>
        /// <param name="isShow">是否显示</param>
        /// <returns></returns>
        Task<int> UpdateShow(long treePermissionConfigId,bool isShow);

        /// <summary>
        /// 删除树形权限
        /// </summary>
        /// <param name="treePermissionConfigId">树形权限配置Id</param>
        /// <returns></returns>
        Task<int> Delete(long treePermissionConfigId);

        /// <summary>
        /// 获取新版无限级树形权限
        /// </summary>
        /// <param name="permissionName">权限名称</param>
        /// <param name="permissionCode">权限码</param>
        /// <param name="permissionPathCode">权限路径码</param>
        /// <param name="parentPermissionPathCode">父级权限路径码</param>
        /// <param name="ascending">升序</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">页面数据条数</param>
        /// <returns></returns>
        Task<(IEnumerable<TreePermissionConfigEntity>, int)> QueryAsync(string permissionName, string permissionCode, string permissionPathCode, string parentPermissionPathCode, bool? ascending, int pageIndex, int pageSize);

        /// <summary>
        /// 获取新版无限级树形权限列表
        /// </summary>
        /// <param name="permissionName">权限名称</param>
        /// <param name="permissionCode">权限码</param>
        /// <param name="permissionPathCode">权限路径码</param>
        /// <param name="parentPermissionPathCode">父级权限路径码</param>
        /// <returns></returns>
        Task<IEnumerable<TreePermissionConfigEntity>> GetList(string permissionName, string permissionCode, string permissionPathCode, string parentPermissionPathCode);
    }
}
